.. This file was automatically converted from MediaWiki syntax. If some markup is wrong, looks weird or doesn't make sense, feel free to fix it. Please remove this comment once this file was manually checked and no "strange ReST" artifacts remain. .. _how-to-compile-a-cxx-panda3d-program-on-linux: How to compile a CXX Panda3D program on Linux ============================================= .. only:: python This page is related to C++ usage of Panda3D and not to Python usage. If you are a Python user, please skip this page. For C++ users, please toggle to the C++ version of this page. .. only:: cxx This short guide explains how to build a Panda3D game written in C++ game under Linux. First of all, download the following files: #. `Python `__, the development package #. The GNU G++ compiler. On most Linux versions, this is already pre-installed. Now, first of all, we need to create a .o file from our cxx file. We need to link to the Panda3D include files and to the Python include files. Please change the paths in these commands to the appropiate locations. :: g++ -c filename.cxx -o filename.o -fPIC -O2 -I{pythoninclude} -I{panda3dinclude} To generate an executable, you can use the following command: :: g++ filename.o -o filename -fPIC -L{panda3dlibs} -lp3framework -lpanda -lpandafx -lpandaexpress -lp3dtoolconfig -lp3dtool -lp3pystub -lp3direct Note: In this two commands, you need to change a few paths: - {pythoninclude}: The path to your Python include folder. For version 2.4, this is /usr/include/python2.4 by default. - {panda3dinclude}: Change this to the path to your Panda3D include directory. This would probably look like /usr/include/panda3d/. - {panda3dlibs}: Change this to the path to your Panda3D libraries. Usually this is just /usr/lib/panda3d or sometimes /usr/lib. Here is an equivalent SConstruct file, organized for clarity: :: pyInc= '/usr/include/python2.4' pandaInc= '/usr/include/panda3d' pandaLib= '/usr/lib/panda3d' Program('filename.cpp', CCFLAGS=['-fPIC', '-O2'], CPPPATH=[pyInc, pandaInc], LIBPATH=pandaLib, LIBS=[ 'libp3framework', 'libpanda', 'libpandafx', 'libpandaexpress', 'libp3dtoolconfig', 'libp3dtool', 'libp3pystub', 'libp3direct']) To run your newly created executable, type: :: ./filename If it runs, congratulations! You have successfully compiled your own Panda3D program!